// .txt

beginzonescript;

variables;

short crime_tolerance = 3;
short last_abil;
short i;
short alert_on = 0;
short test = 0;

body;

beginstate INIT_STATE;
	sf(63,21,0);
	sf(63,22,0);
	
	set_obj_act_at_dist(94,1);
	set_obj_act_at_dist(95,1);
	
	set_name(15,"Merchant");
	set_name(16,"Merchant");
	
	set_aggression(17,9);
	set_aggression(18,9);
	
	set_boss_level(25,1);
	set_name(25,"Oasis Guard");
	set_level(25,28);
	set_boss_level(26,1);
	set_boss_level(27,1);
	set_boss_level(28,1);
	set_boss_level(29,1);
	set_boss_level(30,1);
	set_boss_level(31,1);
	set_boss_level(32,1);
	set_name(32,"Oasis Guard");
	set_level(32,28);
	set_boss_level(33,1);
	set_boss_level(34,1);
	
	set_name(39,"Palace Guard");
	set_boss_level(39,1);
	set_name(40,"Palace Guard");
	set_boss_level(40,1);
	set_name(41,"Palace Guard");
	set_boss_level(41,1);
	set_name(42,"Palace Guard");
	set_boss_level(42,1);
	set_name(43,"Palace Guard");
	set_boss_level(43,1);
	set_aggression(43,9);
	set_name(44,"Palace Guard");
	set_boss_level(44,1);
	set_name(45,"Palace Guard");
	set_boss_level(45,1);
	set_level(39,28);
	set_level(40,28);
	set_level(41,28);
	set_level(42,28);
	set_level(43,28);
	set_level(44,28);
	set_level(45,28);
	
	set_name(46,"Kitchen Servile");
	set_name(47,"Kitchen Servile");
	set_name(52,"Guardian Kulish");
	set_level(52,28);
	set_boss_level(52,2);
	set_aggression(52,8);
	
	set_name(56,"Commander Pritz");
	set_boss_level(56,1);
	set_name(57,"Rebena");
	set_name(58,"Federa");
	set_level(58,18);
	set_courage(58,0);
	set_name(60,"Santela");
	set_name(61,"Tahn");

		
//	add_range_to_group(first,last,whichg);


	if ((creature_type(pc_num()) == 46) || (num_chars_in_group(0) > 1))
		sf(64,3,1);
		else sf(64,3,0);

	if (gf(100,17) > 0) {
		print_str_color("Sage Taygen has learned what you did to his great project.",3);
		print_str_color("  You are not welcome here.",3);
		sf(64,1,1);
		}
	if (gf(100,11) > 0) {
		print_str_color("Word of your infamy has gotten here before you. You are forever marked",3);
		print_str_color("  as a foe of the Shapers.",3);
		sf(64,1,1);
		}
	if (get_sdf(64,1) > 0) {
		make_zone_hostile();
		}
		else {
			print_str_color("This is a friendly city. You are able to rest.",2);
			revive_party();
			}	

	last_abil = get_current_tick();
	
	set_crime_tolerance(crime_tolerance);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((gf(64,1) > 0) && (gf(100,4) == 2)) {
		sf(100,4,3);
		print_str_color("Now that the Zephyr Oasis is angry with you, you will no longer be",3);
		print_str_color("  able to serve Sage Taygen.",3);
		}

	test = 0;
	if ((char_ok(25) == FALSE) || (char_ok(26) == FALSE) || (char_ok(27) == FALSE) || (char_ok(28) == FALSE) || (char_ok(29) == FALSE) || (char_ok(30) == FALSE) || (char_ok(31) == FALSE) || (char_ok(32) == FALSE) || (char_ok(43) == FALSE))
		test = 1;
		
	if ((alert_on == 0) && (gf(64,1) > 0) && (test > 0)) {
		alert_on = 1;
		begin_talk_mode(12);
		}
		
	if ((creature_type(pc_num()) == 46) || (num_chars_in_group(0) > 1))
		sf(64,3,1);
		else sf(64,3,0);

	// clear zone?
	//if ((zone_clear(ME) == FALSE) && (get_flag(,) > 0)) {
		//print_str_color("",2);
		//clear_zone(ME);	
		//}
		
	if ((get_crime_level() >= crime_tolerance) && (get_sdf(64,1) == 0)) {
		make_zone_hostile();
		set_flag(64,1,1);
		}

	if (gf(64,1) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(46 + get_ran(1,0,1),"More bread.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(46 + get_ran(1,0,1),"More stew.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(46 + get_ran(1,0,1),"Am coming ...");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(46 + get_ran(1,0,1),"Am sorry.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(46 + get_ran(1,0,1),"No angry at me.");
		if ((gf(100,4) < 2) && (gf(100,21) == 0)) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"I seek a solution.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"We must win.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"Approach and learn.");
			}
		if (gf(100,4) == 2) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"They will fight us.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"All oppose us.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"We must prevail.");
			}
		if (gf(100,4) == 3) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"Traitor!");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"Get out.");
			}
		if (gf(100,4) < 2) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(51,"What is it?");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(51,"You are intruding.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(51,"I desire privacy.");
			}
		if (gf(100,4) == 2) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(51,"How are you?");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(51,"An ally.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(51,"Taygen chose well.");
			}
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(52,"Need more wingbolts.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(52,"Must absorb the glaahks.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(52,"The roamers are suspect.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(56,"Need allies out here.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(56,"Must hunt the rogues.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(56,"Purify these lands.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(57,"Clang! Clang!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(57,"Aah! Ouch!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(57,"Curse this!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(57,"They did this to me.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(58,"Bah. Bitter.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(58,"Come join me.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(58,"Always staring at me ...");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(58,"Talking behind my back ...");
		if (gf(64,16) == 0) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(59,"Oh, dear.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(59,"You again.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(59,"We've come far.");
			}
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(60,"We're still open!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(60,"The last bazaar ...");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(60,"We buy and sell.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(61,"Sweep. Sweep.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(61,"Sigh.");
		}
	
	if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_group()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
		last_abil = get_current_tick();
		
		if (alert_on > 0) {
			if ((char_ok(35) == FALSE) && (get_ran(1,0,1) == 0)) {
				spawn_creature(27);
				set_name(35,"Oasis Guard");
				set_boss_level(35,1);
				set_summon_level(35,1);
				}
			if ((char_ok(36) == FALSE) && (get_ran(1,0,1) == 0)) {
				spawn_creature(28);
				set_name(36,"Oasis Guard");
				set_boss_level(36,1);
				set_summon_level(36,1);
				}
			if ((char_ok(37) == FALSE) && (get_ran(1,0,1) == 0)) {
				spawn_creature(29);
				set_name(37,"Oasis Guard");
				set_level(37,28);
				set_boss_level(37,1);
				set_summon_level(37,1);
				}
			if ((char_ok(38) == FALSE) && (get_ran(1,0,1) == 0)) {
				spawn_creature(30);
				set_name(38,"Oasis Guard");
				set_level(38,28);
				set_boss_level(38,1);
				set_summon_level(38,1);
				}
			}
		}
break;

beginstate 10;
	set_terrain_string_range("The sign says - Delivery Entrance.",3);
break;

beginstate 11;
	set_terrain_string_range("The sign says - Commander Pritz.",3);
break;

beginstate 12;
break;

beginstate 13;
break;

beginstate 14;
break;

//	print_str("");
//	set_terrain_string_range(".",3);
//	set_terrain_string_range("The sign says - .",3);
